package com.rgs.skywalking.demo.controller;

import com.rgs.skywalking.demo.entity.Result;
import com.rgs.skywalking.demo.entity.vo.ProductVO;
import com.rgs.skywalking.demo.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: rgs-study0project
 * @description:
 * @author: Mr.Ren
 * @create: 2024-08-31 23:03
 **/
@RestController
@RequestMapping("/product")
@Slf4j
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/queryByProductId/{productId}")
    public Result queryByProductId(@PathVariable(value = "productId") String productId) {
        log.info("queryByProductId method {}",productId);
        ProductVO orderVO = productService.queryByProductId(productId);
        return Result.success(orderVO);
    }
}
